﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HOOMT
{
    public partial class FrmLoadProject : Form
    {
        public String projectName;
        public String projectId;
        public FrmLoadProject()
        {
            InitializeComponent();
            initView();
        }

        private void FrmLoadProject_Load(object sender, EventArgs e)
        {

        }

        public void initView()
        {
            this.dataGridView1.DataSource = null;

            DataTable dt1 = new DataTable();

            MainFormDAO dbo = new MainFormDAO();
            dt1 = dbo.GetAllProject();
            if (dt1.Rows.Count > 0)
            {
                dataGridView1.DataSource = dt1;
            }

            
        }

        private void btnLoad_Click(object sender, EventArgs e)
        {
            this.projectId = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
          //  Console.WriteLine("projectId="+projectId);
            this.Visible = false;

        }
//         //显示行号
//         private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
//         {
//             Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
//                                                    e.RowBounds.Location.Y,
//                                                    this.dataGridView1.RowHeadersWidth - 4,
//                                                    e.RowBounds.Height);
// 
//             TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
//                                     this.dataGridView1.RowHeadersDefaultCellStyle.Font,
//                                     rectangle,
//                                     this.dataGridView1.RowHeadersDefaultCellStyle.ForeColor,
//                                     TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
//         }
    }
}
